package com.bao.work.message;

import com.bao.work.message.impl.MessageManagementImpl;

import java.util.Scanner;

/**
 * @author baoye
 * @date 2024-07-31/16:58
 */
public class MainApp {
    public static final MessageManagement MESSAGE_MANAGEMENT =new MessageManagementImpl();
    public static void main(String[] args) {

        while(true){
            System.out.println("----欢迎登录留言板系统----");
            System.out.println("--------主菜单--------");
            System.out.println("\t1.查询留言");
            System.out.println("\t2.添加留言");
            System.out.println("\t3.退出系统");
            System.out.println("请选择");
            int order;
            try{
                order=new Scanner(System.in).nextInt();
            }catch (Exception e){
                System.err.println("只能输入数字");
                continue;
            }

            switch(order){
                case 1:
                    MESSAGE_MANAGEMENT.selectMessage();
                    break;
                case 2:
                    MESSAGE_MANAGEMENT.inputMessage();
                    break;
                default:
                    System.err.println("退出");
                    System.exit(0);
            }
        }

    }
}
